package com.lam.common.components.easyexcel.imp.model;

import java.util.ArrayList;
import java.util.List;

/**
 * @author lam
 *
 * @param <Ie> 用于接收数据对象的Java类
 * @param <R> 用于保存数据对象的Java类
 */
public class ImportWrapper<Ie, R> {
	
	/** 待导入的数据列表 */
	private List<ImportEntry<Ie, R>> dataList;
	
	/** 导入失败的数据列表 */
	private List<ImportEntry<Ie, R>> failList;
	
	/** 是否需要存在时更新，当为True时，则需执行 如果记录已存在，则进行更新记录数据 */
	private boolean isUpdateSupport;
	
	public ImportWrapper(List<ImportEntry<Ie, R>> dataList, boolean isUpdateSupport) {
		this.dataList = dataList;
		this.isUpdateSupport = isUpdateSupport;
	}

	public List<ImportEntry<Ie, R>> getDataList() {
		return dataList;
	}

	public void setDataList(List<ImportEntry<Ie, R>> dataList) {
		this.dataList = dataList;
	}

	public boolean isUpdateSupport() {
		return isUpdateSupport;
	}

	public void setUpdateSupport(boolean isUpdateSupport) {
		this.isUpdateSupport = isUpdateSupport;
	}

	public List<ImportEntry<Ie, R>> getFailList() {
		return failList;
	}

	public void setFailList(List<ImportEntry<Ie, R>> failList) {
		this.failList = failList;
	}
	
	public void addFailEntry(ImportEntry<Ie, R> entry) {
		if(this.failList == null) {
			this.failList = new ArrayList<>();
		}
		this.failList.add(entry);
	}

}
